#ifndef __BASE_MW_OVERLAY_H__
#define __BASE_MW_OVERLAY_H__

#include "base_comm.h"
//#include "base_loadbmp.h"

#ifdef __cplusplus
	extern "C"{
#endif

/* enum */
typedef enum {
	BASE_MW_OVERLAY_SUCCESS,
	BASE_MW_OVERLAY_SHOWBMP_FAIL,
	BASE_MW_OVERLAY_CHANGE_DYNAMICATTR_FAIL,
	BASE_MW_OVERLAY_CHANGE_STATICATTR_FAIL,
	BASE_MW_OVERLAY_SHOWPICTURE_FAIL,
	BASE_MW_OVERLAY_SHOWSTRING_FAIL,
	BASE_MW_OVERLAY_SHOWTIME_FAIL,
	BASE_MW_OVERLAY_FAIL,
} eBASE_MW_OVERLAY_ERROR;

typedef enum {
	BASE_MW_OVERLAY_REGION0,
	BASE_MW_OVERLAY_REGION1,
#ifdef INTER_CMD_REDEFINE
	BASE_MW_OVERLAY_REGION2,
	BASE_MW_OVERLAY_REGION3,
	BASE_MW_OVERLAY_REGION4,
#endif
	BASE_MW_OVERLAY_REGIONCNT,
} eBASE_MW_OVERLAY_COUNT;

typedef enum 
{
    BASE_MW_OVERLAY_CHANGE_TYPE_FGALPHA = 0,
    BASE_MW_OVERLAY_CHANGE_TYPE_BGALPHA,
    BASE_MW_OVERLAY_CHANGE_TYPE_LAYER,
    BASE_MW_OVERLAY_CHANGE_TYPE_POSITION,
    BASE_MW_OVERLAY_CHANGE_TYPE_ZOOM,
}eBASE_MW_OVERLAY_CHANGE_TYPE;

typedef enum {
	BASE_MW_OVERLAY_STATIC_ATTR,
	BASE_MW_OVERLAY_DYNAMIC_ATTR,
	BASE_MW_OVERLAY_INVALID_ATTR
}eBASE_MW_OVERLAY_ATTR_TYPE;

typedef enum {
	BASE_MW_OVERLAY_PICTURE,
	BASE_MW_OVERLAY_STRING,
	BASE_MW_OVERLAY_TIME,
} eBASE_MW_OVERLAY_SHOWTYPE;

typedef enum {
	BASE_MW_OVERLAY_NOTUSE,
	BASE_MW_OVERLAY_NOTSTART,
	BASE_MW_OVERLAY_ISSTART
} eBASE_MW_OVERLAY_STATE;

typedef enum {
	BASE_MW_TIMER_OVERLAY,
	BASE_MW_TIMER_HIFB,
	BASE_MW_TIMER_FLAG,
} eBASE_MW_TIMER_TYPE;

typedef enum {
	eBASE_MW_NOT_SHOWTIME,
	eBASE_MW_IS_SHOWTIME,
} eBASE_MW_SHOWTIME_STATE;

/* struct */
typedef struct {
	LONG lUID[3];
	LONG lRegNum[3];
    	eBASE_MW_OVERLAY_STATE eState[3];
	eBASE_MW_SHOWTIME_STATE eShowTimeState[3];
} sBASE_MW_OVERLAY_USE;

typedef struct {
	LONG lLayer;
	LONG lCmdType;
    	LONG lRgnHandle;
	LONG lShowType;
	LONG lFAlpha;
	LONG lBAlpha;
	LONG lGroupCh;
	LONG lUID;
	MPP_CHN_S sOverlayChn;
	RGN_ATTR_S stOverlayAttr;
	RGN_CHN_ATTR_S stOverlayChnAttr;
	sBASE_MW_OVERLAY_USE sOverlayUse[BASE_MW_OVERLAY_REGIONCNT];
	sBASE_COMM_RECT sRegRect;
#ifdef INTER_CMD_REDEFINE
	RGN_ATTR_S stStrOverlayAttr;
	RGN_CHN_ATTR_S stStrOverlayChnAttr;
	sBASE_COMM_RECT sStrRegRect;
#endif
	eBASE_MW_OVERLAY_ATTR_TYPE eAttrType;
	eBASE_MW_OVERLAY_CHANGE_TYPE eChangeType;
	CHAR cOsdString[BASE_OSDMAXSTRING];
} sBASE_MW_OVERLAY_ATTR;

/* global */
sBASE_MW_OVERLAY_ATTR gsOverlayAttr;
LONG lTimerFlag;
LONG glHifbDevFd;
/*timer id*/
LONG lTimerId[3];


/* function */
eBASE_MW_OVERLAY_ERROR eBASE_MW_OVERLAY_INIT(sBASE_MW_OVERLAY_ATTR* psOverlayAttr);
eBASE_MW_OVERLAY_ERROR eBASE_MW_OVERLAY_START(sBASE_MW_OVERLAY_ATTR* psOverlayAttr);
eBASE_MW_OVERLAY_ERROR eBASE_MW_OVERLAY_changeAttr(sBASE_MW_OVERLAY_ATTR* psOverlayAttr);
eBASE_MW_OVERLAY_ERROR eBASE_MW_OVERLAY_STOP(sBASE_MW_OVERLAY_ATTR* psOverlayAttr);
eBASE_MW_OVERLAY_ERROR eBASE_MW_OVERLAY_ShowBmp(sBASE_MW_OVERLAY_ATTR* psOverlayAttr);
void vShowTime(void*);


#ifdef __cplusplus
	}
#endif

#endif
